From fbd62525cf0973a912a7e90d350aac94c1188349 Mon Sep 17 00:00:00 2001 From: "mjw@wray-m-3.hpl.hp.com" Date: Fri, 20 Aug 2004 09:11:43 +0000 Subject: [PATCH] bitkeeper revision 1.1159.1.91 (4125c04fdFsBys6pCPgiqHACIMhgWQ) Support NFS root by creating the block device controller for a domain even when it has no disks. --- tools/python/xen/xend/XendDomainInfo.py | 25 +++++++++++++++++-------- tools/python/xen/xend/server/blkif.py | 3 ++- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 309521ef81..f394bdee66 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -466,7 +466,7 @@ class XendDomainInfo: # my domain id. if not dominfo: return - print 'check_name>', 'dom=', dominfo.name, dominfo.dom, 'self=', name, self.dom + #print 'check_name>', 'dom=', dominfo.name, dominfo.dom, 'self=', name, self.dom if dominfo.is_terminated(): return if not self.dom or (dominfo.dom != self.dom): @@ -922,12 +922,10 @@ class XendDomainInfo: def configure(self): """Configure a vm. - vm virtual machine - config configuration - - returns Deferred - calls callback with vm + @return: deferred - calls callback with vm """ - d = self.create_devices() + d = self.create_blkif() + d.addCallback(lambda x: self.create_devices()) d.addCallback(self._configure) return d @@ -942,16 +940,27 @@ class XendDomainInfo: d.addErrback(cberr) return d + def create_blkif(self): + """Create the block device interface (blkif) for the vm. + The vm needs a blkif even if it doesn't have any disks + at creation time, for example when it uses NFS root. + + @return: deferred + """ + ctrl = xend.blkif_create(self.dom, recreate=self.recreate) + back = ctrl.getBackend(0) + return back.connect(recreate=self.recreate) + def dom_construct(self, dom, config): """Construct a vm for an existing domain. - @param dom: domain id + @param dom: domain id + @param config: domain configuration @return: deferred """ d = dom_get(dom) if not d: raise VmError("Domain not found: %d" % dom) - print 'dom_construct>', dom, config try: self.restore = 1 self.setdom(dom) diff --git a/tools/python/xen/xend/server/blkif.py b/tools/python/xen/xend/server/blkif.py index 4a683610cb..00f19a805d 100755 --- a/tools/python/xen/xend/server/blkif.py +++ b/tools/python/xen/xend/server/blkif.py @@ -15,6 +15,8 @@ from messages import * class BlkifBackendController(controller.BackendController): """ Handler for the 'back-end' channel to a device driver domain. + Must be connected using connect() before it can be used. + Do not create directly - use getBackend() on the BlkifController. """ def __init__(self, ctrl, dom, handle): @@ -287,7 +289,6 @@ class BlkifController(controller.SplitController): def __init__(self, factory, dom): """Create a block device controller. - The controller must be connected using connect() before it can be used. Do not call directly - use createInstance() on the factory instead. """ controller.SplitController.__init__(self, factory, dom) -- 2.30.2